package top.yueyazhui.ask_for_leave.util;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.annotation.Configuration;

/**
 * @Author yueyazhui
 * @Date 2023/2/13
 */
@Configuration
public class BeanUtil implements BeanFactoryAware {

    static BeanFactory beanFactory;

    public static <T> T getBean(Class<T> tClass) {
        return beanFactory.getBean(tClass);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }
}
